import { HttpInterface } from "./HttpInterface";
import { HttpUniImpl } from './HttpUniImpl'

export class DefaultFactory{
	
	private static http:HttpInterface
	
	static getInstance():HttpInterface{
		if(DefaultFactory.http){
			return DefaultFactory.http
		}
		const MODEL_UNI='UNI'
		const models=[MODEL_UNI]
		let model:string = process.env.VUE_APP_TICK_HTTP__MODEL
		model = model || MODEL_UNI
		if(models.indexOf(model) < 0){
			throw "VUE_APP_TICK_HTTP__MODEL 配置错误"
		}
		model = model.toUpperCase()
		
		switch(model){
			case MODEL_UNI:
				DefaultFactory.http = new HttpUniImpl();
				break;
				
			default:
		}
		return DefaultFactory.http
	}
}